var post_jsondata = parent.$("#post_jsonData").val();
var isNesting = parent.$("#isNesting").val();
var json_post_jsondata = eval("("+post_jsondata+")");
var modelid = parent.$("#modelId").val();
var modelname = parent.$("#modelName").val();
var modelIntroduction = parent.$("#modelIntroduction").val();
var index = parent.layer.getFrameIndex(window.name);
window.onload = function(){
    $("#name").val(modelname);
    $("#InputText1").val(modelIntroduction);
    if(isNesting=="0"){
        $(".radio-position").show();
    }
    if(parent.$("#modelIsreuse").val()){
        $("#is_use_again")[0].checked = true;
    }else{
        $("#no_again")[0].checked = true;
    }
    $('#updateModel').click(function () {
        var name = $("#name").val();
        var InputText1 = $("#InputText1").val();
        var isReuse = $("input[name='again']:checked").val();
        console.log(isReuse);
        $.ajax({
            url:constUrl+"ws/model",
            type:'post',
            data:{
                "operateType":"alterModel",
                "data":JSON.stringify({
                    "name":name,
                    "modelId":modelid,
                    "isNesting":isNesting,//是否嵌套
                    "introduction":InputText1,
                    "isReuse":isReuse,//是否可复用
                    "json":json_post_jsondata,//模型的整体json
                    "nestJson":""//嵌套部分的json
                })
            },
            dataType:'json',
            success: function(responseText) {
                if(responseText.result)
                    parent.layer.alert("修改成功！");
                parent.layer.close(index);
            },
            complete: function() {},
            error: function() {}
        })
    });
    $('#closeIframe').click(function(){
    	parent.layer.close(index);
    });
}